import java.io.FileInputStream;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;



public class Property {

	private String nameClient;
	private Properties dataSettings;
	private List keysSort;
	private HashMap<String, String> ds;
	
	public Property(String nameClient) throws Exception {
		this.nameClient = nameClient;
		dataSettings = new Properties();
		dataSettings.load(new FileInputStream("Data.ini"));
		keysSort = getSortListSuppliers();
	}
	
	private  List getSortListSuppliers() {
		Enumeration keys = dataSettings.keys();
	    while(keys.hasMoreElements()){
	    	String key = (String)keys.nextElement();
	    	String value = dataSettings.getProperty(key);
	    	dataSettings.remove(key);
	    	key = key.replaceFirst(nameClient + ".", "");
	    	dataSettings.put(key, value);
	    }
	    List keysSort = Collections.list(dataSettings.keys());
	    Collections.sort(keysSort);
		return keysSort;
	}

	public Properties getDataSettings() {
		return dataSettings;
	}

	public List<String> getKeysSort() {
		return keysSort;
	}
	
	
}
